<template>



<table class="table table-bordered">


    <tr>

            <th>手机号</th>
            <th>
                <input type="text" v-model="aa.Phone">
            </th>
    </tr>

    <tr>

<th>密码</th>
<th>
    <input  type="password" v-model="aa.pwd">
</th>
</tr>

<tr>

<th></th>
<th>
    <button @click="Login">登陆</button>
</th>
</tr>

</table>




</template>


<script setup lang="ts">



import router from '@/router';
import axios from 'axios';
import{ref}from'vue'

import { useRouter,createRouter } from 'vue-router';


const aa =ref({

    Phone:"",
    pwd:"",



})


import { useCounterStore } from '@/stores/use'; 
const vv=useCounterStore();
console.log(vv);
const Login=()=>{

    axios.get('https://localhost:7055/api/Login/Login',{params:{
        Phone:aa.value.Phone,
        Pwd:aa.value.pwd,


    }}).then(res=>{
        console.log(res.data);
            if(res.data.id==-1)
            {
                alert('手机号不存')
            }
            else if(res.data.id==-2)
            {
                alert('密码错误')
            }
            else if(res.data.id==1)
            {
                alert('登陆成功')
                router.push('/ShowFangHao')
                vv.cc="管理员"
                
            }
            else
            {
                alert('登陆失败')
            }

    })
}





</script>